
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    
<%@ page import="java.net.URL" %>
<%@ page import="java.util.Iterator" %>  
<%@ page import="org.dom4j.Attribute" %>  
<%@ page import="org.dom4j.Document" %>  
<%@ page import="org.dom4j.Element" %>  
<%@ page import="org.dom4j.io.SAXReader" %>  

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>VOA Special English Study</title>
</head>
<body>

	
<%

try
{
    URL url = new URL("http://www.voanews.com/templates/Articles.rss?sectionPath=/learningenglish/home");
    SAXReader saxReader = new SAXReader();
    Document document = saxReader.read(url);

    Element channel = (Element) document.getRootElement().element("channel");
%>
	<table>
<%
    for (Iterator i = channel.elementIterator("item"); i.hasNext();)
    {


    	Element element = (Element) i.next();
	    Element source = element.element("enclosure");
		Attribute attribute = source.attribute("url");
		
		String audioUrl= "";
		//Element media_group = element.element("media:group");
		//media_group.elementIterator("media:content");
		
		/*
		for (Iterator j = media_group.elementIterator("media:content"); j.hasNext();){
			Element media_content = (Element) j.next();
			if(null != media_content.attribute("type")){
				audioUrl = media_content.attribute("type").getValue();
			}
		}
		*/
		
		String picUrl = attribute.getValue();
		String title = element.elementText("title");
		String link = element.elementText("link");
		String description = element.elementText("description");
		%>
		
		<tr>
			<td algin="center">
				<img src="<%=picUrl %>" />
			</td>
			<td>
				<ul>
					<li>Title: <%=title %></li>
					<li>Description: <%=description %></li>
					<li>link: <%=link %></li>
					<li>audio link: <%=audioUrl %></li>
					<li>
						<object id="single1" width="300" height="24" data="http://www.voanews.com/MediaAssets2/player/jw/player.swf" type="application/x-shockwave-flash">
							<param name="data" value="http://www.voanews.com/MediaAssets2/player/jw/player.swf">
							<param name="name" value="single1">
							<param name="allowfullscreen" value="true">
							<param name="allowsc-riptaccess" value="always">
							<param name="wmode" value="transparent">
							<param name="flashvars" value="file=http://www.voanews.com/MediaAssets2/learningenglish/dalet/se-ed-food-to-desk-environmental-charter-12may11.Mp3&amp;backcolor=7FA3BD&amp;frontcolor=FFFFFF">
							<param name="src" value="http://www.voanews.com/MediaAssets2/player/jw/player.swf">
							<param name="bgcolor" value="#ffffff">
						</object>
					</li>
				</ul>
			</td>
		</tr>

		<%
	       
       
    }
%>
	</table>
	<br>
	
	  
<%
}
catch (Exception e)
{
    e.printStackTrace();
}

%>
</body>
</html>